//microcommand define dismiss
ctx = ctx.platform("onebot")
signature("", { checkArgCount: true, checkUnknown: true, authority: 3 })
option("channel", "-g, -c, --guild, --group <id>", { authority: 3, descPath: "admin.channel-option" })
option("yes", "-y", { descPath: "lnnbot.admin.yes-option" })
action(async ({ session, options }) => {
const groupId = options.channel?.slice(options.channel.split(":", 1)[0].length + 1) || session.channelId
const g = await session.bot.getGuild(groupId).catch(() => ({ id: groupId, name: groupId }))
if (!options.yes) {
session.send(session.i18n(".confirm", g))
if (!["Y", "y"].includes((await session.prompt())?.trim())) return session.i18n(".cancelled")
}
await session.onebot.setGroupLeave(groupId)
})
locale("zh-CN", {
description: "令 bot 退群",
messages: {
confirm: "确定退出群聊 {name}（{id}）吗？请发送 y 以确认…",
cancelled: "已取消操作。",
},
})